<!DOCTYPE html>
<html>
    <body>
        <p>请输入数字</p>
        <input id = "demo" type = "text">
        <script>
           function isnum(){
            x = document.getElementById("demo").value;
            if(x == "" || isNaN(x)){
                alert("不是数字");
            }
            else {
                alert("符合是数字");
            }
           }
        </script>
        <button type = "button" onclick = "isnum()"> 检查是不是符合的数字</button>
    </body>
</html>